package com.itqian.seller.service.impl;

import com.itqian.seller.entity.StoreInfo;
import com.itqian.seller.mapper.StoreInfoMapper;
import com.itqian.seller.service.StoreInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * <p>
 * 餐厅商店信息表 服务实现类
 * </p>
 *
 * @author shishuqian
 * @since 2022-03-21
 */
@Service
public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo> implements StoreInfoService {

    @Autowired
   private StoreInfoMapper storeInfoMapper;

    @Override
    public boolean addDefaultStore(Integer sellerId) {

        //设置店铺默认信息
        StoreInfo storeInfo = new StoreInfo();
        storeInfo.setSellerId(sellerId)
                .setStoreName("默认店铺名(请自行修改)")
                .setStorePhone("12345678900(默认联系电话，请自行修改)")
                .setStoreAddress("默认店铺地址(请自行修改)")
                .setStoreIcon(null)
                .setStoreOpenTime("9:00 - 18:00(默认营业时间，请自行修改)")
                .setStoreNotice("默认店铺公告，请自行修改")
                .setStoreType("默认店铺类型，请自行修改")
                .setMinPrice(BigDecimal.valueOf(8.00))
                .setPostPrice(BigDecimal.valueOf(2.00))
                .setStoreStatus(false);

        int insert = storeInfoMapper.insert(storeInfo);

        return insert == 1;
    }
}
